<?php

class Customer extends E_ARB {

	protected $belongs_to = array('user');
	protected $has_many = array('performainvoices');


	static function authenticate($cid, $pass, $key) {
		if (isset($_SESSION['enc_key']) && $key === $_SESSION['enc_key']) {
			$userPassArr = Customer::find('all', 'Customer', array('select' => 'hashed_password', 'conditions' => "id = $cid"));
			if (sizeof($userPassArr) === 1) { return sha1($_SESSION['enc_key'] . sha1($userPassArr[0]->hashed_password.'only mahees shou*&^ld know th$4$is!')) === $pass; }
			////pass from db sould never have to be hashed i do this cos its not hashed in the db yet
		}
		return false;
	}




}

?>